package day14.com.zhiyou100;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Vector;

public class Demo03 {
    public static void main(String[] args) {
        LinkedList<String> linkedList = new LinkedList<>();
        linkedList.add("aa");
        linkedList.add("bb");
        linkedList.add("dd");
        linkedList.add("ff");

        // 我想要知道ff元素在linkedList所在的位置
        int index = 0;
        for (int i = 0; i < linkedList.size(); i++) {
            if ("ff".equalsIgnoreCase(linkedList.get(i))){
                index = i;
            }
        }
        int ff = linkedList.indexOf("ff");
        System.out.println(ff);
        System.out.println("ff在linkedlist中的位置：" + index);

    }
}
